<template>
  <div>
    <el-row type="flex" justify="center">
      <!-- gutter 栅格间距 -->
      <el-col :span="1">
        <!-- span 栅格占的列数，offset是偏移列数 -->
      </el-col>
    </el-row>
    <el-row type="flex" justify="center">
      <!-- gutter 栅格间距 -->

      <el-col :span="1.5" class="card1">
        <!-- span 栅格占的列数，offset是偏移列数 -->
        <h1 class="hh1">您已完成测试！</h1>

        <el-card class="box-card" shadow="never" style="height: 500px">
          <div style="height: 70px">您的MBTI鉴定结果为:</div>
          <div class="mname">
            {{ mal }}-{{ mname }}
          </div>

          <div style="height: 60px">
            <el-input
              v-model="input1"
              size="large"
              placeholder="输入学号"
              :prefix-icon="Search"
            >
            </el-input>
          </div>
          <div style="height: 60px">
            <el-input
              v-model="input2"
              size="large"
              placeholder="输入测试时间"
              :prefix-icon="Search"
            >
            </el-input>
          </div>
          <div style="height: 70px">
            <el-button type="primary" @click="insertlog()">提交</el-button>
            <!-- <el-button type="primary" @click="router()"
              >MBTI character</el-button
            > -->
          </div>
        </el-card>

        <div style="margin: 0 auto">
          <el-divider></el-divider>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { h } from "vue";
import { ElNotification } from "element-plus";
import { ref } from "vue";
import { Search } from "@element-plus/icons-vue";
export default {
  name: "Testover",
  data() {
    return {
      mal: "",
      mname: "",
      ssz: "1",
      vue: "/",
      input1: ref(""),
      input2: ref(""),
    };
  },
  methods: {
    router() {
      this.vue = this.vue.concat(this.mal);
      this.$router.push({ path: this.vue });
    },
    insertlog() {
      this.$axios.get("/insertlog", {
        params: {
          sid: this.input1,
          date: this.input2,
          mal: this.mal,
          ssz: this.ssz,
        },
      });
      ElNotification({
        title: "成功！",
        message: h("i", { style: "color: coral" }, "数据已上传！"),
      }).catch(function (error) {
        // 处理错误情况
        console.log(error);
      });
    },
  },
  created() {
    const that = this;
    this.$axios
      .get("/getres")
      .then(function (response) {
        // 处理成功情况
        that.mal = response["data"]["mal"];
        that.mname = response["data"]["mname"];
        that.ssz = response["data"]["ssz"];
      })
      .catch(function (error) {
        // 处理错误情况
        console.log(error);
      });
  },
  setup() {
    const activeNames = ref([""]);
    const value = ref();
    const icons = [Search];
    return { activeNames, value, icons };
  },
};
</script>

<style scoped>
.hh1 {
  font-size: 30px;
  text-align: center;
  color: rgb(90, 99, 107);
}
.el-row {
  margin-bottom: 50px;
}
.grid-content {
  border-radius: 4px;
  min-height: 5px;
  min-width: 100px;

  text-align: center;
}
.card1 {
  height: 80vh;
  width: 1100px;
  border-radius: 30px;
}
.box-card{
  height: 800px;
  width: 1100px;
}
.mname{
  height: 70px; 
  color: deepskyblue;  
  font-size: 45px;
  font-weight: bold;
}
</style>
